<template>
  <div class="pageIndex">
    <div class="banner-ct">
      <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
        <van-swipe-item v-for="(item, index) in banner" :key="index">
          <img :src="item.picUrl" alt="" />
        </van-swipe-item>
      </van-swipe>
      <ul>
        <li>
          <img src="../../assets/img/love.png" alt="">
          <p>签到</p>
        </li>
        <li>
          <img src="../../assets/img/lv.png" alt="">
          <p>礼券</p>
        </li>
        <li>
          <img src="../../assets/img/wg.png" alt="">
          <p>砍价</p>
        </li>
        <li>
          <img src="../../assets/img/dp.png" alt="">
          <p>专栏</p>
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
import { useRouter } from "vue-router";
import { getBanner } from "../../api/home/index.js";
import { reactive, ref, toRefs } from "vue";
export default {
  setup() {
    // setup 没有了this指向
    const data = reactive({
      banner: [], // 轮播图的数据
    });
    getBanner().then((res) => {
      // 获取轮播图的接口
      data.banner = res.data;
    });

    return {
      ...toRefs(data),
    };
  },
};
</script>
<style lang="scss" scoped>
.pageIndex {
  .banner-ct{
    position: relative;
    ul{
      position: absolute;
      left: 0;
      bottom: 0;
      display: flex;
      width: 100%;
      background: #fff;
      padding: 20px 0;
      box-sizing: border-box;
      border-radius: 20% 20% 0 0;
      height: 106px;
      li{
        width: 25%;
        display: inline-flex;
        justify-content: center;
        flex-wrap: wrap;
        align-content: space-between;
        img{
          width: 42px;
        }
        p{
          font-size: 15px;
          width: 100%;
          text-align: center;
        }
      }
    }
  }
  .my-swipe {
    img {
      width: 100%;
    }
  }
}
</style>
